<!DOCTYPE html>
<html xmlns:th="http://www.thymeleaf.org">
<head>
  <meta charset="UTF-8">
  <title>修改教师信息</title>
  <link rel="stylesheet" href="/bootstrap/css/bootstrap.min.css" crossorigin="anonymous">
  <style>
    body {
      display: flex;
      flex-direction: column;
      min-height: 100vh;
      margin: 0;
    }

    /* 中间内容区域样式 */
    .middle-content {
      display: flex;
      flex: 1;
    }

    /* 内容区域样式 */
    .content {
      flex: 1;
      padding: 20px;
      overflow-y: auto;
    }

    /* 表单样式 */
    .form-container {
      max-width: 600px;
      margin: 0 auto;
      padding: 20px;
      background-color: #fff;
      border-radius: 5px;
      box-shadow: 0 0 10px rgba(0, 0, 0, 0.1);
    }

    .form-title {
      margin-bottom: 20px;
      text-align: center;
      color: #333;
    }

    .form-group {
      margin-bottom: 15px;
    }

    .form-actions {
      display: flex;
      justify-content: space-between;
      margin-top: 20px;
    }
  </style>
</head>
<body>
<!-- 顶部导航栏 -->
<div th:replace="header.html"></div>

<!-- 中间内容区域 -->
<div class="middle-content">
  <!-- 侧边导航栏 -->
  <div th:replace="nav.html"></div>

  <!-- 主内容区 -->
  <div class="content">
    <div class="form-container">
      <h2 class="form-title">修改教师信息</h2>

      <form th:action="@{/Teacher/edit}" method="post">

        <input type="hidden" name="id" th:value="${teacher.id}">

        <div class="form-group">
          <label for="name">姓名</label>
          <input type="text" class="form-control" id="name" name="name"
                 th:value="${teacher.name}" required>
        </div>

        <div class="form-group">
          <label for="password">密码</label>
          <input type="password" class="form-control" id="password" name="password"
                 th:value="${teacher.password}" required>
        </div>

        <div class="form-group">
          <label>性别</label>
          <div class="form-check">
            <input class="form-check-input" type="radio" name="sex" id="male" value="1"
                   th:checked="${teacher.sex == 1}">
            <label class="form-check-label" for="male">男</label>
          </div>
          <div class="form-check">
            <input class="form-check-input" type="radio" name="sex" id="female" value="0"
                   th:checked="${teacher.sex == 0}">
            <label class="form-check-label" for="female">女</label>
          </div>
        </div>
        <div class="form-group">
          <label for="birthday">生日</label>
          <input type="date" class="form-control" id="birthday" name="birthday"
                 th:value="${teacher.birthday}" required>
        </div>
        <div class="form-group">
          <label for="course_id">主教课程</label>
          <select class="form-control" id="course_id" name="course_id" required>
            <option value="">请选择一个主教课程</option>
            <option th:each="course : ${courses}"
                    th:value="${course.id}"
                    th:text="${course.name}">
            </option>
          </select>
        </div>

        <div class="form-group">
          <label for="professional">专业</label>
          <input type="text" class="form-control" id="professional" name="professional"
                 th:value="${teacher.professional}" required>
        </div>

        <div class="form-actions">
          <button type="button" class="btn btn-secondary" onclick="window.history.back()">取消</button>
          <button type="submit" class="btn btn-primary">保存修改</button>
        </div>
      </form>
    </div>
  </div>
</div>

<!-- 页脚 -->
<div th:replace="footer.html"></div>

<!-- 引入JS库 -->
<script src="/bootstrap/js/jquery.js" crossorigin="anonymous"></script>
<script src="/bootstrap/js/bootstrap.bundle.min.js" crossorigin="anonymous"></script>
</body>
</html>